﻿<phone:PhoneApplicationPage 
    x:Class="ALiteTeam.PackageTracer.View.View.Details"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="True"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    xmlns:GalaSoft_MvvmLight_Command="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP71"
    DataContext="{Binding Source={StaticResource ViewModelLocator}, Path=DetailsViewModel}">
   
    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot">
        <!--设定配置好的背景图-->
        <Grid.Background>
            <ImageBrush ImageSource="{Binding BackgroundImage, Source={StaticResource ViewModelLocator}}"/>
        </Grid.Background>
        <!--Pivot Control-->
        <controls:Pivot Title="风讯快递查询">
            <!--Pivot item one-->
            <controls:PivotItem Name="pivotMainItem" Header="{Binding DisplayName}">
                <Grid>
                    <TextBlock Name="lblOrderNo" Text="{Binding Path=OrderNo, StringFormat=运单编号：\{0\}}" Height="30" HorizontalAlignment="Left" VerticalAlignment="Top" Width="250" Margin="0,50,0,0" />
                    <TextBlock Name="lblTitle" Text="{Binding Path=Title}" Height="50" HorizontalAlignment="Left" VerticalAlignment="Top" Width="250" Margin="0" FontSize="32" FontWeight="Bold" />
                    <ScrollViewer HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,85,0,0">
                        <ScrollViewer.Content>
                            <ListBox Name="lstDetails" ItemsSource="{Binding Details}" Height="450">
                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <Grid>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="160*" />
                                                <ColumnDefinition Width="300*" />
                                            </Grid.ColumnDefinitions>
                                            <TextBlock Text="{Binding Path=Time, StringFormat='\{0:MM月dd日 HH:mm\}  '}" Width="Auto" Grid.Column="0"/>
                                            <TextBlock Text="{Binding Path=Context, StringFormat='\{0\}'}" Grid.Column="1" Width="Auto" Height="Auto" TextWrapping="Wrap" />
                                        </Grid>
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                            </ListBox>
                        </ScrollViewer.Content>
                    </ScrollViewer>
                    <toolkit:PerformanceProgressBar 
                        Name="performanceProgressBar" Height="100" Width="470"
                        IsIndeterminate="{Binding Path=IsIndeterminate}"
                        Foreground="{StaticResource PhoneAccentBrush}" 
                        Background="{StaticResource PhoneAccentBrush}" />
                </Grid>
            </controls:PivotItem>
            <controls:PivotItem Header="设置">
                <Grid>
                    <TextBlock Height="30" HorizontalAlignment="Left" Margin="0,108,0,0" Name="textBlock2" Text="{Binding ElementName=slider, Path=Value, StringFormat=间隔\{0\}小时刷新：}" VerticalAlignment="Top" />
                    <Slider Height="84" HorizontalAlignment="Left" IsEnabled="{Binding ElementName=toggleSwitch, Path=IsChecked}" LargeChange="2" Margin="0,138,0,0" Maximum="12" Minimum="0.5" Name="slider" Value="{Binding Path=RefreshDuration, Mode=TwoWay}" VerticalAlignment="Top" Width="450">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="ValueChanged">
                                <GalaSoft_MvvmLight_Command:EventToCommand
                            Command="{Binding SaveCommand}" />
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </Slider>
                    <toolkit:ToggleSwitch FontFamily="Segoe WP" FontWeight="Normal" Header="开启自动更新" Height="111" HorizontalAlignment="Left" IsChecked="{Binding Path=IsAutoRefresh, Mode=TwoWay}" Margin="10,10,0,0" Name="toggleSwitch" VerticalAlignment="Top" Width="456" >
                        <toolkit:ToggleSwitch.HeaderTemplate>
                            <DataTemplate>
                                <ContentControl Content="开启自动更新" Foreground="{StaticResource PhoneForegroundBrush}" />
                            </DataTemplate>
                        </toolkit:ToggleSwitch.HeaderTemplate>
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="Checked">
                                <GalaSoft_MvvmLight_Command:EventToCommand
                            Command="{Binding SaveCommand}" />
                            </i:EventTrigger>
                            <i:EventTrigger EventName="Unchecked">
                                <GalaSoft_MvvmLight_Command:EventToCommand
                            Command="{Binding SaveCommand}"/>
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </toolkit:ToggleSwitch>
                </Grid>
            </controls:PivotItem>
        </controls:Pivot>
    </Grid>
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Opacity="0.5">
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
    
</phone:PhoneApplicationPage>